import React, { Component } from 'react'
import FormContainer from './FormContainer'

export default class Form extends Component {

  constructor(){
    super();
    this.state={
      name:''
    }
  }

  render() {
    return (
      <FormContainer>
        <input type="text" value={this.state.name}
        onChange={(event)=>{
          this.setState({
            name:event.target.value
          })
        }}
        className="txt"/>
        <button onClick={()=>this.props.search(this.state.name)}>查询</button>
        <button onClick={()=>this.props.add(this.state.name)}>添加</button>
      </FormContainer>
    )
  }
}
